import Vue from 'vue'
import FastClick from 'fastclick'
import store from './store'
import router from './router'
import App from './App'
import { sync } from 'vuex-router-sync'
import Language from './i18n/index'
import * as lodash from 'lodash'

sync(store, router);

Vue.i18n.add('en', Language.en);
Vue.i18n.set('en');

//lodash
Vue.prototype._ = lodash;

import { DatetimePlugin, CloseDialogsPlugin, ConfigPlugin, BusPlugin, LocalePlugin, DevicePlugin, ToastPlugin, AlertPlugin, ConfirmPlugin, LoadingPlugin, WechatPlugin, AppPlugin } from 'vux'

Vue.use(ConfigPlugin, {
	$layout: 'VIEW_BOX'
})

// plugins
Vue.use(DevicePlugin)
Vue.use(ToastPlugin)
Vue.use(AlertPlugin)
Vue.use(ConfirmPlugin)
Vue.use(LoadingPlugin)
Vue.use(WechatPlugin)
Vue.use(BusPlugin)
Vue.use(DatetimePlugin)

// test
if (process.env.platform === 'app') {
	Vue.use(AppPlugin, store)
}

FastClick.attach(document.body)
Vue.config.productionTip = false
/* eslint-disable no-new */

new Vue({
	store,
	router,
	render: h => h(App)
}).$mount('#app-box')
